class TFMDDrugs extends Powerups;

var float lastsound;

replication
{
    reliable if( Role==ROLE_Authority )
	lastsound;
}

state Activated
{
	function BeginState()
	{
		initialstate='activated';
        if(instigator==none) instigator=pawn(owner);
        bActive = true;
        settimer(0.1, true);
	}

    simulated function Timer()
    {
        tfpri(pawn(owner).playerreplicationinfo).drugged=true;

        pawn(owner).health--;

        if(level.timeseconds>lastsound+0.4+frand()*0.15 && playercontroller(pawn(owner).controller)!=none)
        {
            lastsound=level.timeseconds;
            playercontroller(pawn(owner).controller).clientflash(0.3, vect(500,0,50));
            playercontroller(pawn(owner).controller).ClientPlaySound(sound'TFMedia.TFMDHeartBeat');
        }

        if(instigator==none || instigator.Health<=10)
        {
            GotoState('');
            Destroy();
        }
    }

	function EndState()
	{
        if(playercontroller(pawn(owner).controller)!=none)
            playercontroller(pawn(owner).controller).ClientPlaySound(sound'TFMedia.TFMDDrugEnd');

        tfpri(pawn(owner).playerreplicationinfo).drugged=false;
        bActive = false;
	}

}

defaultproperties
{
     bAutoActivate=True
     bActivatable=True
     bReplicateInstigator=True
}
